#include "headfiles.h"

using namespace std;

int main(int argc, char **argv) {
    if (argc != 3) {
        cout << "Usage: " << argv[0] << " in_file1 in_file2" << endl;
        return 0;
    }

    int *array_a, *array_b;
    int elem_num_a, elem_num_b;

    string file_name1(argv[1]);
    string file_name2(argv[2]);
    
    bool ret_code;
    ret_code = readInput(file_name1.c_str(), 0, 
                         array_a, elem_num_a);
    ret_code = readInput(file_name2.c_str(), elem_num_a,
                         array_b, elem_num_b);
    int array_b_size = elem_num_a + elem_num_b;

    quickSort(array_a, elem_num_a);
    quickSort(array_b, elem_num_b);

    cout << "Array_a:" << endl;
    printArray(array_a, elem_num_a);

    cout << "Array_b:" << endl;
    printArray(array_b, elem_num_b);

    mergeArrays(array_b, array_a, elem_num_b, elem_num_a);

    cout << "Merged array" << endl;
    printArray(array_b, array_b_size);

    delete array_a;
    delete array_b;

    return 0;
}

